<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,initial-scale=1.0,width=device-width"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>大奔农庄</title>
    <link rel="stylesheet" type="text/css" href="../../css/api.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/aui.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/style.css"/>    
    <link rel="stylesheet" href="../../css/swiper.min.css">
</head>

<body class="body-header-fixed">
	<header class="aui-bar aui-bar-nav top-nav" id="title">
		<a class="aui-pull-left aui-btn"></a> 
		<div class="aui-title" id="db_title">大奔农庄</div>
	</header>
	<div id="db_zhanwei"></div>
	<div id="idx_box">	
		<!--滚动-->
		<div class="swiper-auto">
			<div class="swiper-container">
			    <div class="swiper-wrapper" id="idx_Slidertop">
			    <!--
			        <div class="swiper-slide"><img src="../../image/banner.jpg" width="100%" ></div>
			        <div class="swiper-slide"><img src="../../image/banner.jpg" width="100%" ></div>
			    -->
			    </div>
			</div>
		</div>
		<!--滚动结束-->
		
		<!--8个栏目-->
		<section class="aui-grid in-box aui-border-b ">
			<div class="row aui-text-center">
				<div class="aui-col-3 in-tubiao" onclick="openShangcheng();">
				    <div class="icon-t"><img src="../../image/1.png"></div>
			        <p style="line-height: 1.6rem; color:#333">商城</p>
				</div>
				<div class="aui-col-3 in-tubiao" onclick="openYingyu();">
					<div class="icon-t"><img src="../../image/2.png"></div>
					<p style="line-height: 1.6rem; color:#333">影娱</p>
				</div>
				<div class="aui-col-3 in-tubiao" onclick="openJinrong();">
					<div class="icon-t"><img src="../../image/3.png"></div>
					<p style="line-height: 1.6rem; color:#333">金融</p>
				</div>
				<div class="aui-col-3 in-tubiao" onclick="openXinxi();">
					<div class="icon-t"><img src="../../image/4.png"></div>
					<p style="line-height: 1.6rem; color:#333">信息</p>
				</div>
				<div class="aui-col-3 in-tubiao" onclick="openShenghuo();">
				    <div class="icon-t"><img src="../../image/5.png"></div>
			        <p style="line-height: 1.6rem; color:#333">生活</p>
				</div>
			</div>
		</section>
		<!--8个栏目结束-->
		
		<!--两个广告轮播-->
		<section class="aui-grid swiper-auto-xiao in-boxx yinying">
			<div class="row aui-text-center">
				<div class="aui-col-xs-6">
					<div class="swiper-container">
					    <div class="swiper-wrapper" id="swiper-wrapper_left">
					    <!-- 
					        <div class="swiper-slide"><img src="../../image/b-ban1.jpg" width="100%" ></div>
					        <div class="swiper-slide"><img src="../../image/b-ban1.jpg" width="100%" ></div>
					    -->
					    </div>
					</div>
				</div>
				<div class="aui-col-xs-6">
					<div class="swiper-container">
					    <div class="swiper-wrapper" id="swiper-wrapper_right">
					     <!-- 
					        <div class="swiper-slide"><img src="../../image/b-ban1.jpg" width="100%" ></div>
					        <div class="swiper-slide"><img src="../../image/b-ban1.jpg" width="100%" ></div>
					     					    -->
					    </div>
					</div>
				</div>
			</div>
		</section>
		<!--两个广告轮播-->
		
		<!--影视娱乐-->
		<div class="aui-content aui-margin-t-15 yinying">
		    <ul class="aui-list aui-list-in border-none">
		        <li class="aui-list-item aui-list-item-middle ">
		            <div class="aui-list-item-inner aui-list-item-arrow">
		                <div class="aui-list-item-title yingyu-se" onclick="openYingyu();">影视娱乐</div>
		            </div>
		        </li>
	        </ul>
		</div>
		<div class="swiper-yangshi">
			<div class="swiper-container">
		        <div class="swiper-wrapper" id="idx_yingyu">
		        <!-- 
			        <div class="swiper-slide swiper-size" onclick="openYingyu();"><img src="http://daben.demo.dx623.com/Public/Uploads/Picture/2017-07-18/596ddb7c14420.jpg" width="100%" ></div>
	            	<div class="swiper-slide swiper-size" onclick="openYingyu();"><img src="http://daben.demo.dx623.com/Public/Uploads/Picture/2017-07-18/596ddb7c14420.jpg" width="100%" ></div>
	            	<div class="swiper-slide swiper-size" onclick="openYingyu();"><img src="http://daben.demo.dx623.com/Public/Uploads/Picture/2017-07-18/596ddb7c14420.jpg" width="100%" ></div>
	            	<div class="swiper-slide swiper-size" onclick="openYingyu();"><img src="http://daben.demo.dx623.com/Public/Uploads/Picture/2017-07-18/596ddb7c14420.jpg" width="100%" ></div>
				 -->
				</div>
		    </div>
	    </div>
	    <!--影视娱乐-->
	    <!--金融-->
		<div class="aui-content yinying">
		    <ul class="aui-list aui-list-in border-none">
		        <li class="aui-list-item aui-list-item-middle ">
		            <div class="aui-list-item-inner aui-list-item-arrow">
		                <div class="aui-list-item-title yingyu-se" onclick="openJinrong();">金融</div>
		            </div>
		        </li>
	        </ul>
		</div>
		<div class="swiper-yangshi">
			<div class="swiper-container">
		        <div class="swiper-wrapper" id="idx_jinrong">
		        <!-- 
			        <div class="swiper-slide swiper-size" onclick="openYingyu();"><img src="http://daben.demo.dx623.com/Public/Uploads/Picture/2017-07-18/596ddb7c14420.jpg" width="100%" ></div>
	            	<div class="swiper-slide swiper-size" onclick="openYingyu();"><img src="http://daben.demo.dx623.com/Public/Uploads/Picture/2017-07-18/596ddb7c14420.jpg" width="100%" ></div>
	            	<div class="swiper-slide swiper-size" onclick="openYingyu();"><img src="http://daben.demo.dx623.com/Public/Uploads/Picture/2017-07-18/596ddb7c14420.jpg" width="100%" ></div>
	            	<div class="swiper-slide swiper-size" onclick="openYingyu();"><img src="http://daben.demo.dx623.com/Public/Uploads/Picture/2017-07-18/596ddb7c14420.jpg" width="100%" ></div>
				 -->
		        </div>
		    </div>
	    </div>
	    <!--金融-->
	    
	    <!--生活导购-->
		<div class="aui-content yinying">
		    <ul class="aui-list aui-list-in border-none">
		        <li class="aui-list-item aui-list-item-middle ">
		            <div class="aui-list-item-inner aui-list-item-arrow">
		                <div class="aui-list-item-title yingyu-se" onclick="openShenghuo();">生活导购</div>
		            </div>
		        </li>
	        </ul>
		</div>
		<div class="swiper-yangshi">
			<div class="swiper-container">
		        <div class="swiper-wrapper" id="idx_shenghuo">
		         <!-- 
 			        <div class="swiper-slide swiper-size" onclick="openYingyu();"><img src="http://daben.demo.dx623.com/Public/Uploads/Picture/2017-07-18/596ddb7c14420.jpg" width="100%" ></div>
 	            	<div class="swiper-slide swiper-size" onclick="openYingyu();"><img src="http://daben.demo.dx623.com/Public/Uploads/Picture/2017-07-18/596ddb7c14420.jpg" width="100%" ></div>
 	            	<div class="swiper-slide swiper-size" onclick="openYingyu();"><img src="http://daben.demo.dx623.com/Public/Uploads/Picture/2017-07-18/596ddb7c14420.jpg" width="100%" ></div>
 	            	<div class="swiper-slide swiper-size" onclick="openYingyu();"><img src="http://daben.demo.dx623.com/Public/Uploads/Picture/2017-07-18/596ddb7c14420.jpg" width="100%" ></div>
 				  -->
		        </div>
		    </div>
	    </div>
	    <!--生活导购-->
	    
		<!--信息供求大厅-->
		<div class="aui-content">
		    <ul class="aui-list aui-list-in border-none">
		        <li class="aui-list-item aui-list-item-middle ">
		            <div class="aui-list-item-inner aui-list-item-arrow">
		                <div class="aui-list-item-title yingyu-se" onclick="openXinxi();">供求信息大厅</div>
		            </div>
		        </li>
	        </ul>
		</div>
		<section class="aui-content gqdt-box">
		    <div class="aui-row" id="idx_gongqiu">
			<!--		    
		        <div class="aui-xs-6" onclick="openArtinfo('1','供求信息');">
		            <big class="aui-text-warning db_aui-text-warning"><img src="../../image/s-1.jpg"></big>
		            <div class="aui-gird-lable aui-font-size-14">融诺网专业团队辅助</div>
		            <div class="aui-font-size-12 ">融诺网专业团队辅助陕西省光热项目成功融资3000</div>
		        </div>
		    -->
		    </div>
		</section>
		<!--信息供求大厅-->
	</div>	
</body>
<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript" src="../../script/common.js"></script>
<script type="text/javascript" src="../../script/swiper.min.js"></script>
<link rel="stylesheet" type="text/css" href="../../css/aui-pull-refresh.css" />
<script type="text/javascript" src="../../script/aui-pull-refresh.js"></script>
<script>
//变量声明
var db_key = 'user',db_user;
var useParam={}; useParam.rtk = RSapi.myrtk;
//下拉刷新
var pullRefresh = new auiPullToRefresh({
    container: document.querySelector('#idx_box'), //下拉容器
    triggerDistance: 50 //下拉高度
},function(ret){
    if(ret.status=="success"){
        setTimeout( function() {
		 	//加载头部轮播图
		    var sliderbigarr = {rtk: RSapi.myrtk, cate:1};
		    loaddata('idxsliderbig',sliderbigarr,RSapi.base+RSapi.allSlider,'idx_Slidertop','1');
		    //加载左侧轮播图
		    var slidersmallarr = {rtk: RSapi.myrtk, cate:2};
		    loaddata('idxslidersamall',slidersmallarr,RSapi.base+RSapi.allSlider,'swiper-wrapper_left','2');
		    //加载右侧轮播图
		    var sliderleftarr = {rtk: RSapi.myrtk, cate:3};
		    loaddata('idxsliderleft',sliderleftarr,RSapi.base+RSapi.allSlider,'swiper-wrapper_right','2');
		    //加载影视娱乐信息
		    loaddata('idxyingyu',useParam,RSapi.base+RSapi.idxYingyu,'idx_yingyu','3');
		    //加载金融信息
//		    loaddata('idxjinrong',useParam,RSapi.base+RSapi.idxJinrong,'idx_jinrong','3');
		    //加载生活导购信息
//		    loaddata('idxshenghuo',useParam,RSapi.base+RSapi.idxShenghuo,'idx_shenghuo','3');
		    //加载供求信息
		    loaddata('idxgongqiu',useParam,RSapi.base+RSapi.idxArticle,'idx_gongqiu','0');
		    //刷新成功后调用此方法隐藏
			pullRefresh.cancelLoading(); 
        },900)
    }
})
//页面初始化
apiready = function() {
	//获取用户信息 
    getuser();
	//监听登录
    api.addEventListener({
        name: 'login_self'
    }, function(ret, err) {
        getuser();
    });
    //监听注销事件
    api.addEventListener({
        name: 'mylogout'
    }, function(ret, err) {
        //更新会员的登录状态
        db_user = $api.getStorage(db_key);
    })
    //加载头部轮播图
    var sliderbigarr = {rtk: RSapi.myrtk, cate:1};
    loaddata('idxsliderbig',sliderbigarr,RSapi.base+RSapi.allSlider,'idx_Slidertop','1');
    //加载左侧轮播图
    var slidersmallarr = {rtk: RSapi.myrtk, cate:2};
    loaddata('idxslidersamall',slidersmallarr,RSapi.base+RSapi.allSlider,'swiper-wrapper_left','2');
    //加载右侧轮播图
    var sliderleftarr = {rtk: RSapi.myrtk, cate:3};
    loaddata('idxsliderleft',sliderleftarr,RSapi.base+RSapi.allSlider,'swiper-wrapper_right','2');
    //加载影视娱乐信息
    loaddata('idxyingyu',useParam,RSapi.base+RSapi.idxYingyu,'idx_yingyu','3');
    //加载金融信息
    loaddata('idxjinrong',useParam,RSapi.base+RSapi.idxJinrong,'idx_jinrong','3');
    //加载生活导购信息
    loaddata('idxshenghuo',useParam,RSapi.base+RSapi.idxShenghuo,'idx_shenghuo','3');
    //加载供求信息
    loaddata('idxgongqiu',useParam,RSapi.base+RSapi.idxArticle,'idx_gongqiu','0');
}
//获取用户储存在本地的数据
function getuser() {
    db_user = $api.getStorage(db_key);
    try {
        if (db_user.islogin && db_user.mytoken) {
           
        }else {
            domreset();
        }
    }catch(e) {
        domreset();
    }
}
//退出登录或判断用户未登录时，界面显示数据重置
function domreset() {
    db_user = {islogin: false};
    $api.setStorage(db_key,db_user);
}
//加载内容方法
//加载轮播图;flag->轮播图显示位置；1-头部，2-左侧，3-右侧
function loaddata(status,param,url,domid,flag) {
	api.ajax({
		url: url,
		method: 'post',
		cache: false,
		timeout: 30,
		dataType: 'json',
		data: { values: param },
	}, function(ret, err){
		if(err){
//			api.toast({msg: JSON.stringify(err)});
			api.alert({msg: err.msg});
		}else {
			if (ret.status>0) {
				//成功了
				$api.html($api.byId(domid), ' ');
				$api.append($api.byId(domid),ret.info);
				if(flag == 1){
					sliderBig();//大轮播图
				}
				if(flag == 2){
					sliderSmall();//小轮播图
				}
				if(flag == 3){
					sliderLeft();//左滑轮播图
				}
				api.parseTapmode();
				eval('status_'+status+'=true;');
			}else {
				//失败了
				api.toast({msg: ret.info});
			}
		}
	});
}
//大轮播图
function sliderBig(){
	var swiper = new Swiper('.swiper-auto .swiper-container', {
	    pagination: '.swiper-pagination',
	    nextButton: '.swiper-button-next',
	    prevButton: '.swiper-button-prev',
	    paginationClickable: true,
	    spaceBetween: 30,
	    centeredSlides: true,
	    autoplay: 2500,
	    autoplayDisableOnInteraction: false
	});
}
//小广告轮播图
function sliderSmall(){
	var swiper = new Swiper('.swiper-auto-xiao .swiper-container', {
	    pagination: '.swiper-pagination',
	    nextButton: '.swiper-button-next',
	    prevButton: '.swiper-button-prev',
	    paginationClickable: true,
	    spaceBetween: 30,
	    centeredSlides: true,
	    autoplay: 3500,
	    autoplayDisableOnInteraction: false
	});
}
//左划轮播图
function sliderLeft(){
	var swiper = new Swiper('.swiper-yangshi .swiper-container', {
        pagination: '.swiper-pagination',
        slidesPerView: 1.5,
        paginationClickable: true,
        spaceBetween: 30,
        freeMode: true
    });
}
//打开商城
function openShangcheng(){
    api.openWin({
        name: 'win_shangcheng',
        url: '../win/shangcheng_win.html'
    });
}
//打开金融
function openJinrong(){
    api.openWin({
        name: 'win_Jinrong',
        url: '../win/jinrong_win.html'
    });
}
//打开影视娱乐
function openYingyu(){
    api.openWin({
        name: 'win_yingyu',
        url: '../win/yingyu_win.html'
    });
}
//打开生活导购
function openShenghuo(){
    api.openWin({
        name: 'win_shenghuo',
        url: '../win/shenghuo_win.html'
    });
}
//打开信息
function openXinxi(){
    api.openWin({
        name: 'win_Xinxi',
        url: '../win/xinxi_win.html'
    });
}
//打开金融、影视娱乐、生活详情
function openXinxiinfo(id,title,type){
    api.openWin({
        name: 'win_xinxiinfo',
        url: '../win/xinxiinfo_win.html',
        pageParam: {infoid: id,pagetitle:title,infotype:type}
    });
}   
//打开信息详情
function openArtinfo(id,title){
    api.openWin({
	        name: 'win_artinfo',
	        url: '../win/artinfo_win.html',
	        pageParam: {artid: id,pagetitle:title}
        });
}   
//打开产品
function openGoodsinfo(id,title){
    api.openWin({
        name: 'win_goodsinfo',
        url: '../win/goodsinfo_win.html',
        pageParam: {gid: id,pagetitle:title}
    });
}  
</script>
<script>
     
    </script>
</html>